<!--
* description: 责任部门
* author: zxuan
* createdDate: 2019-11-25
-->
<template>
  <section class="dutyManagment">
    <el-col
      :span="span"
    >
      <lableName
        :validrule="validrule"
        :curLabelName="curLabelName"
        :isShowLabel="isShowLabel"
        :isRequire="isRequire"
      ></lableName>
      <el-input
        placeholder="请选择"
        v-model="modelText"
        :disabled="disabled"
        size="small"
        suffix-icon="el-icon-menu"
        @clear="clearCode"
        clearable
        @blur="sendCode"
        @focus="getFocusCode"
      ></el-input>
      <validateFormate :curLabelName="curLabelName"></validateFormate>
    </el-col>
    <duty
      :popupsVisible="curPopupsVisible"
      :codeField="codeField"
      :textField="textField"
      :comType="comType"
      :valueObject="curValueObject"
      :popupsKey="popupsKey"
      :code="modelCode"
      :text="modelText"
      :key="curPopupsKey"
      :isMul="isMul"
      @changeCode="getComponentCode1"
    ></duty>
  </section>
</template>
<script>
import { searchInputMixins } from "@/components/mixins/searchInputMixins";
import { valueObjectMixins } from "@/components/mixins/valueObjectMixins";
// import lableName from "@/components/lableName";
import duty from "@/components/crm/crmEjectWindows/crmDutyManagement/duty";
// import validateFormate from "@/components/validateFormate";
export default {
  // 组件混入对象
  mixins: [searchInputMixins, valueObjectMixins],
  components: {
    duty,
    lableName: () => import("@/components/lableName"), //标题溢出样式组件
    validateFormate: () => import("@/components/validateFormate"), //校验提示样式组件
  },
  data() {
    return {
      curLabelName: this.labelName === "" ? "责任部门" : this.labelName
    };
  },
  methods: {
    //传递网格列数据
    getComponentCode1(code,text,codeField,comType,popupsKey,textField,otherField,selectData) {
      this.getComponentCode(code,text,codeField,comType,popupsKey,textField,otherField,selectData);
      var parent = this.$utils.getHasFormFieldParentComponent(this);
      let results = selectData[0];
      for (let key in parent.formField) {
        if (results.hasOwnProperty(key)) {
          parent.formField[key] = results[key];
        }
      }
      debugger
      parent.formField.assignCompanyCode=results.orgCode
      this.$emit("emitCode", selectData);
    },
    // 重写显示时执行事件
    // onShow() {
    //   var parent = this.$utils.getHasFormFieldParentComponent(this);
    //   if (
    //     parent.formField &&
    //     parent.formField.carBrandCode &&
    //     parent.formField.carBrandCode !== ""
    //   ) {
    //     //赋值
    //     this.curValueObject.carBrandCode = parent.formField.carBrandCode;
    //     this.curPopupsKey = this.codeField + this.$utils.generateId();
    //   } else {
    // this.$alert('请先选择品牌', '提示', {
    //   confirmButtonText: '确定',
    //   callback: action => {
    //     this.close()
    //   }
    // })
    //   }
    // }
  }
};
</script>
